/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rational.sheet.table.cell.model;

import org.rational.sheet.table.RationalParser;
import org.rational.sheet.table.RationalTableData;
import org.rational.sheet.table.cell.model.format.CellFormat;
import org.rational.sheet.table.cell.model.format.NumericCellFormat;
import org.rational.sheet.table.cell.model.setting.CellView;

/**
 *
 * @author Overmind
 */
public class Cell
{
    private CellValue value;
    private CellView view;
    private CellFormat format;
    
    public Cell(RationalParser parser)
    {
	this("", new CellView(), new NumericCellFormat(), parser);
    }
    
    public Cell(String value, CellView view,
	    CellFormat format, RationalParser parser)
    {
        this.value = new CellValue(value, parser);
        this.view = view;
	this.format = format;
    }
    
    public String getFormula()
    {
	return value.getFormula();
    }
    
    public String getValue()
    {
        return value.getValue();
    }
    
    public String getFormatedValue()
    {
        return format.formated(getValue());
    }
    
    public CellView getView()
    {
	return view;
    }
    
    public CellFormat getFormat()
    {
	return format;
    }
    
    public void setFormula(String formula)
    {
        value.setFormula(formula);
    }
    
    public void setView(CellView view)
    {
	this.view = view;
    }
    
    public void setFormat(CellFormat format)
    {
	this.format = format;
    }
}
